@use "../../assets/scss/mixins/text/text" as *;

@include gwf(Kavoon, Wendy One, Bonbon);
html {
  box-sizing: border-box;
  //根元素字体大小；10 / 16 = 62.5%，采用rem单位时，1rem = 10px
  font-size: 62.5%;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
  &:before,
  &:after {
    box-sizing: inherit;
  }
}
body {
  width: 100%;
  height: 100vh;
  background-color: #222;
  font-family: sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}
.wrapper {
  position: relative;
  display: flex;
  gap: 40px;
  .element {
    position: relative;
    width: 100px;
    height: 100px;
    display: block;
    transform: rotate(315deg);
    overflow: hidden;
    &:nth-of-type(1) {
      font-family: Kavoon;
    }
    &:nth-of-type(2) {
      font-family: Wendy One;
    }
    &:nth-of-type(3) {
      font-family: Bonbon;
    }
    .content {
      display: flex;
      align-items: center;
      justify-content: center;
      position: absolute;
      inset: 20px;
      background-color: #685752;
      .text {
        color: #fff;
        font-weight: normal;
        transform: rotate(45deg);
        font-size: 2em;
        text-transform: uppercase;
      }
    }
    &::before,
    &::after {
      content: "";
      position: absolute;
      right: 0;
    }
    &::before {
      width: 100%;
      height: 2px;
      background-image: linear-gradient(90deg, transparent, greenyellow);
      transform: translateX(-100%);
      animation: animateBefore calc(var(--total, 4) * 1s) linear infinite;
      animation-delay: calc(var(--i) * 1s);
    }
    &::after {
      width: 2px;
      height: 100px;
      background-image: linear-gradient(180deg, transparent, greenyellow);
      transform: translateY(-100%);
      animation: animateAfter calc(var(--total, 4) * 1s) linear infinite;
      animation-delay: calc(var(--i) * 1s);
    }
  }
}
@keyframes animateBefore {
  0% {
    transform: translateX(-100%);
  }
  20%,
  100% {
    transform: translateX(100%);
  }
}
@keyframes animateAfter {
  0%,
  12.5% {
    transform: translateY(-100%);
  }
  37.5%,
  100% {
    transform: translateY(100%);
  }
}
